if not %POCKETBOOKSDK%.==. goto C1
echo Environment variable POCKETBOOKSDK is not set
pause
:C1
set PATH=%POCKETBOOKSDK%\arm-linux\bin;%POCKETBOOKSDK%\bin;%PATH%

set INCLUDE=-I/arm-linux/include
set LIBS=-linkview -lz -lfreetype -lpng -ljpeg
set OUTPUT=ImageViewer.app

rm -f %OUTPUT%
rm -f Release/*.o

set IMAGES=
rem if not exist images\*.bmp goto NOIMG
rem set IMAGES=%TEMP%\images.temp.c
rem pbres -c %IMAGES% images/*.bmp
rem if errorlevel 1 goto L_ER
:NOIMG

rem gcc -Wall -O2 -fomit-frame-pointer %INCLUDE% -c src/qsp/*.c src/qsp/onig/*.c src/qsp/onig/enc/*.c %IMAGES%
g++ -Wall -O2 -fomit-frame-pointer %INCLUDE% -c src/*.cpp %IMAGES%
if errorlevel 1 goto L_ER

g++ -Wall -O2 -fomit-frame-pointer %INCLUDE% -o %OUTPUT% *.o %LIBS% 
if errorlevel 1 goto L_ER

rm -f *.o
echo Built OK!
pause
exit 0

:L_ER
echo Built with ERRORS!
pause
exit 1 